package luogu;

import java.util.Arrays;
import java.util.Scanner;

public class P1598 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = "";
        for (int i = 0; i < 4; i++) {
            s1 += sc.nextLine();
        }
        s1 = s1.replace(" ", "");
        int[] arr = new int[26];
        for (int i1 = 0; i1 < s1.length(); i1++) {
            char ch = s1.charAt(i1);
            if (ch >= 'A' && ch <= 'Z') {
                arr[ch - 'A']++;
            }
        }
        int maxNum = Arrays.stream(arr).max().getAsInt();
        for (int i = maxNum; i >= 1; i--) {
            for (int i1 = 0; i1 < arr.length; i1++) {
                if (arr[i1] >= i){
                    System.out.print("*");
                }else {
                    System.out.print(" ");
                }
                System.out.print(" ");
            }
            System.out.println();
        }
        System.out.print("A " + "B " + "C " + "D " + "E " + "F " + "G " + "H " + "I " + "J " + "K " + "L " + "M " + "N " + "O " + "P " + "Q " + "R " + "S " + "T " + "U " + "V " + "W " + "X " + "Y " + "Z");
    }
}
